/*
 * @Author: your name
 * @Date: 2021-10-14 10:10:25
 * @LastEditTime: 2021-10-14 17:11:33
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \mustache_lk\index.js
 */
import parseTemmplateTokens from './parseTmplateTokens'
import renderTemplate from './renderTemplate'
console.log('---------------手写mustache，入口文件-------------');
// webpack 打包文件默认将对象添加在window中，可以直接使用
window.Mustache_lk = {
    render(templateStr, data) {
        // 调用parseTemmplateTokens将字符串变为tokens数组
        let tokens = parseTemmplateTokens(templateStr)
        let innertext = renderTemplate(tokens, data)
        console.log('最终数据：', innertext);
        return innertext
    }
}